import { Entity, Column, Unique, Index, EntityRepository } from 'typeorm'
import { BaseEntity } from '../global'

@Entity('user')
@Unique(['userid'])
@Unique(['phone'])
export class User extends BaseEntity {
    @Column({ length: 32 })
    userid: string

    @Column({ length: 32, nullable: true, comment: '企业ID' })
    companyid: string

    @Column({ length: 16 })
    phone: string

    @Index()
    @Column({ length: 32, nullable: true })
    account: string

    @Column({ length: 32, nullable: true })
    password: string

    @Column({ length: 64, comment: '名称' })
    name: string

    @Column('int', { default: 0, comment: '性别，0未知1男2女' })
    sex: number

    @Column({
        length: 1024,
        default: 'https://bty-file.oss-cn-hangzhou.aliyuncs.com/bty/logo/%E7%BA%AF%E8%89%B21000*1000.png',
        comment: '头像',
    })
    avatar: string

    @Column({ length: 32, nullable: true, comment: '身份证号' })
    userno: string

    @Column({ length: 32, nullable: true, comment: '生日' })
    birthday: string

    @Column({ length: 1024, default: '', comment: '签名备注' })
    note: string

    @Column('int', { default: 0, comment: '用户状态，0正常1锁定2黑名单' })
    status: number
}
